package com.zzb.framework.starter.xxljob.conf;

import com.baomidou.dynamic.datasource.DynamicDataSourceConfigure;
import com.baomidou.dynamic.datasource.spring.boot.autoconfigure.druid.DruidDynamicDataSourceConfiguration;
import com.xxl.job.admin.core.conf.XxlJobAdminConfig;
import org.springframework.boot.autoconfigure.AutoConfigureBefore;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Import;

@Configuration
@AutoConfigureBefore(XxlJobAdminConfig.class)
@Import(DruidDynamicDataSourceConfiguration.class)
public class DynamicConfiguration {

    @Bean
    public DynamicDataSourceConfigure dynamicDataSourceConfigure() {
        return DynamicDataSourceConfigure.config()
                .regexMatchers("com.xxl.job.*", "xxljob");
    }


}
